package admin.yaojunText;


import java.beans.IntrospectionException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.*;

import admin.action.fruits.Constant;
import admin.bean.Note;
import admin.service.fruits.AwardService;
import admin.service.fruits.DegreePaperService;
import admin.service.fruits.NoteService;
import admin.service.fruits.ProjectService;
import admin.service.fruits.StudentAwardService;
import admin.service.fruits.StudentProjectService;
import admin.service.member.StudentService;
import admin.service.subject.InnovationService;

import teacher.bean.Award;
import teacher.bean.Paper;
import teacher.bean.Patent;
import teacher.bean.Project;
import teacher.bean.Stuaward;
import teacher.bean.Studegreepaper;
import teacher.bean.Students;
import teacher.bean.Teacher;
import teacher.bean.Treatise;
import teacher.service.award;
import teacher.service.paper;
import teacher.service.patent;
import teacher.service.project;
import teacher.service.teacher;
import teacher.service.treatise;
import tools.FruitsToDbInterface;
import tools.FruitsToDbService;
import tools.RandomCreateNum;
import tools.StringDate;

public class YaojunTest {
	


	public static void main(String[] args) throws IllegalArgumentException, IntrospectionException, IllegalAccessException, InvocationTargetException
	{
		
//		Subject s=new Subject();
//		s.setArea("浙江省杭州市");
//		s.setChargePerson("姚俊");
//		s.setEmail("459828686@qq.com");
//		s.setName("控制工程与科学");
//		s.setSuperLevelDate("2015-05-22");
//		s.setUniversity("浙江工业大学");
//		s.setMainWeb("www.zjut.edu.cn");
//		
//		
//		SubjectService ss=new SubjectService();
//		ss.insertSubject(s);
		
		//插入一个老师信息
		//Teacher tea=new Teacher("", user, password, subject, direction, duty, degree, state, online, birthday, expertClass, furStud, topSchool, topMajor, mail)
		
//		List<Subject> subjects=new SubjectService().getAllSubject();
//		
//		for(Subject sub:subjects)
//		{
//			System.out.println("名称为:"+sub.getName());
//		}
		
//		System.out.println("该学科的数量为:"+new SubjectService().getCountSubject());
//		
//		Subject sss=new Subject();
//		sss.setSubId(3);
//		sss.setName("科学");
//		
//		
//		Subject subject=new SubjectService().getSubject(sss);
//		System.out.println("姓名为:"+subject.getName());
//		List<Subject> subjects=new SubjectService().getAllSubjectByName(sss);
//		
//		for(Subject sub:subjects)
//		{
//			System.out.println("名称为:"+sub.getName());
//		}
		
//		new SubjectService().deleteSubject(sss);
		
		
		//PullTeacherToExcel.teacherExcel();
		
//	List<Teacher> teachers=	new teacher().SelectAllTeacher();
//	
//	for(Teacher t:teachers)
//	{
//		System.out.println("学位为:"+t.getName());
//	}
	
//	Teacher tea=new Teacher();
//	tea.setName("冯老师");
		
		//new paper().selectAllPaper();
		//new treatise().selectAllTreatise();
//		new patent().selectAllPatent();
		//new project().selectAllProject();
		//new patent().selectAllPatent();
		
//		Teacher tea=new Teacher();
//		tea.setName("冯老师");
//		tea.setBirthday(new java.util.Date());
//		tea.setMail("459828686@qq.com");
//		tea.setPassword("123");
//		tea.setUser("123");
//		tea.setPower(0);
//		
//		new teacher().
		
		
//		List<Award> awards=new ArrayList<Award>();
//		awards=new award().selectAllAward();
//		
//		for(Award a:awards)
//		{
//			System.out.println("日期为:"+a.getName());
//		}
		
//		List<Project> ps=new ArrayList<Project>();
//		ps=new project().selectTimeProject(StringDate.StringToDate("2011-00-00"),StringDate.StringToDate("2014-00-00"));
//		
//		for(Project p:ps)
//		{
//			System.out.println("日期为:"+p.getName());
//		}
//		
//		Award a1=new Award();
//		a1.setDate(StringDate.StringToDate("2012-00-00"));
//		Award a2=new Award();
//		a2.setDate(StringDate.StringToDate("2015-00-00"));
//		
//		
//		PullAwardToExcel.awardExcel(1,a1,a2);
		
//		Treatise trea=new Treatise();
//		trea.setTreId(1);
//		Treatise tre=new TreatiseService().getTreatise(trea);
//		System.out.println("fdsafdsa"+tre.getTreId());
//		tre.setState(1);
//		new TreatiseService().updateTreatise(tre,trea );
		
		
//		Paper pa=new Paper();
//		pa.setPapId(1);
//		Paper pap=new PaperService().getPaper(pa);
//		System.out.println("fdsafdsa"+pap.getPapId());
//		pap.setState(0);
//		new PaperService().updatePaper(pap, pa);
		
//		
//		Project pr=new Project();
//		pr.setProId(4);
//		Project pro=new ProjectService().getProject(pr);
//		System.out.println("fdsafdsa"+pr.getProId());
//		pro.setProId(0);
//		new ProjectService().updateProject(pro, pr);
		
		
//		List<Award> awards=new ArrayList<Award>();
//		awards=new award().selectAllAward();
//		for(Award a:awards)
//		{
//			System.out.println("fdsafdsa"+a.getTeaId());
//		}
		
//		Award aw=new Award();
//		aw.setAwaId(2);
//		Award awa=new AwardService().getAward(aw);
//		System.out.println("fdsafdsa"+awa.getName());
////		Award awa=new AwardService().getAward(aw);
////		awa.setState(0);
////		new AwardService().updateAward(awa, aw);
//		
//		Teacher tea=new teacher().SelectTeaByAwa(awa);
//		System.out.println("fdasfdsa"+tea.getName());
		
		
//		Treatise tr=new Treatise();
//		tr.setTreId(1);
//		Treatise tre=new TreatiseService().getTreatise(tr);
//		System.out.println("fdasfdsa"+new teacher().SelectTeaByTre(tre).getTeaId());
		
//		Teacher tea=new Teacher();
//		tea.setUser("yaojun");
//		
//		
//		Teacher tea2=new teacher().SelectTeacher(tea);
//		tea2.setName("姚俊");
//		System.out.println("姓名为:"+tea.getUser());
//		new TeacherService().updateTeacher(tea2, tea);
		
//		InnovationService is=new InnovationService();
//		System.out.println(is.getCountInnovationsByLevel(7));
		
//		PlatformService ps=new PlatformService();
//		System.out.println(ps.getCountPlatformByLevel(3));

//		List<Treatise> ts=new treatise().selectAllTreatise();
//		for(Treatise t:ts)
//		{
//			System.out.println("姓名为："+t.getUpload());
//		}
//		
//		List<Patent> patents=new PatentService().getSegregatePatentByDate
//				(StringDate.StringToDate("2015-01-01"), 
//						StringDate.StringToDate("2015-01-01"), 
//						1, 2);
//		
//		
//		for(Patent p:patents)
//		{
//			System.out.println("姓名为:"+p.getName());
//		}
		
//		List<Map<Integer,String>> lists=GetInfoByExcel.getAllByExcel("D://yaojun.xlsx");
//		for(Map map:lists)
//		{
//
//				System.out.println("老师姓名为:"+map.get(1));
//			
//		}
		
//		List<Award> awards=new AwardService().getAwardByState(2);
//		for(Award a:awards)
//		{
//			System.out.println("姓名为:"+a.getName());
//		}
//		Teacher tea=new Teacher();
//		tea.setDirection(3);
//		
//		System.out.println(new LeaderServiceAdmin().getCountOfProjectArriveFunds(tea));
//		System.out.println(new LeaderServiceAdmin().getCountOfProjectFunds(tea));
//		
//		
//		    int max=999999;
//	        int min=000000;
//	        Random random = new Random();
//
//	        int s = random.nextInt(max)%(max-min+1) + min;
//	        System.out.println(s);
//	        
	        
//	       System.out.println(RandomCreateNum.createNum(6));
//		
//		Teacher tea=new Teacher();
//		tea.setName("姚俊");
//		tea.setUser("yaojun");
////		tea.setPassword("1234556");
//		//System.out.println(new TeacherService().CheckUserAndName(tea));
//		
//		new TeacherService().mendTeacherPass(tea);
		
		
//		String html="12,13,12,12,12,12,12;";
//        StringTokenizer st = new StringTokenizer(html,",");
//        while(st.hasMoreTokens() ){
//            System.out.println(st.nextToken());
//        }
		
//		Paper paper=new Paper();
		//paper.setJclass(2);
		//paper.setName("蛋白质");
		//paper.setPubPage("1");
		//paper.setTauthor("张三");
//		System.out.println(new PaperService().getCountPaper(paper));
		
//		Teacher tea=new Teacher();
		
//		Award awa=new Award();
//		//awa.setName("浙江");
//		awa.setPeople("梁荣华");
//		//awa.setDate(StringDate.StringToDate("2014-12-17"));
//		List<Award> list=new AwardService().getAwardByAll(awa,null,0);
//		for(Award a:list)
//		{
//			System.out.println("姓名为:"+a.getPeople());
//		}
		
		
//		Paper pap=new Paper();
//		//pap.setName("蛋白质");
//		pap.setPbulication("浙大");
//		pap.setDate(StringDate.StringToDate("2012-03-02"));
//		List<Paper> list=new PaperService().getPaperByAll(pap, "2014-01-01");
//		for(Paper p:list)
//		{
//			System.out.println("名称为:"+p.getName());
//		}
//		
//		
//		Award a=new Award();
//		a.setDate(StringDate.StringToDate("2010-02-03"));
	
//		Treatise trea=new Treatise();
//		trea.setName("最优化");
//		//trea.setDate(StringDate.StringToDate("2013-01-01"));
//		List<Treatise> lists=new TreatiseService().getTreatiseByAll(trea,"2015-01-01");
//		for(Treatise t:lists)
//		{
//			System.out.println("名称为:"+t.getName());
//		}
		
		
//		Award a=new Award();
//		Teacher te=new Teacher();
//		a.setLevel(2);
//		te.setUser("02549");
//		System.out.println("汤一平三等奖的数量为"+new AwardService().getAwardCountByUser(
//				a, null, te));
		
		
//		Project p=new Project();
//		p.setLeader("张贵军");
//		List<Project> ps=new ProjectService().getSegregateProjectByDirection(p, 1, 1, 1);
//		for(Project pp:ps)
//			System.out.println(pp.getName());
		
		FruitsToDbInterface t=new FruitsToDbService();
		t.AwardToDb("E:\\award.xls");
		//t.PaperToDb("E:\\paper.xls");
		t.ProjectToDb("E:\\project.xls");
		t.PatentToDb("E:\\patent.xls");
		t.TreatiseToDb("E:\\treatise.xls");
		
//		
//		List<Studegreepaper> ss=new DegreePaperService().getSegregateDegreePaperByDirection(null, 1, 3);
//		System.out.println("长度为:"+ss.size());
//		System.out.println("dfdsafdsa");
//		for(Studegreepaper st:ss)
//		{
//			System.out.println("dfdsafdsa");
//			System.out.println("名称为:"+st.getDegname());
//			System.out.println("名称为:"+st.getDegaward());
//		}
		
//		Stuaward f=new Stuaward();
//		f.setAwakind(2);
//		f.setAwalevel(321);
//		System.out.println("数量为:"+new StudentAwardService().getCountStuAwardByAll(f));
		
//		Students ss=new Students();
//		ss.setName("321");
//		List<Students> students=new StudentService().getStudentByAll(ss);
//		for(Students s:students)
//		{
//			System.out.println("学生的姓名为:"+s.getName());
//		}
		
		
//		List<Award> awards=new AwardService().getAwardByAll(null, null,0, Constant.state);
//		for(Award a:awards)
//		{
//			System.out.println("名称为:"+a.getName());
//			System.out.println("作者为:"+a.getPeople());
//		}
		
//		Note n=new Note();
//		n.setContent("你好，我是你的好朋友，你是什么人");
//		n.setTitle("fdsa");
//		n.setFromUser(1);
//		n.setToUser(2);
//		n.setState(1);
//		
//		new NoteService().insertNote(n);
		
		
		/*Note n=new Note();
		n.setState(0);
		List<Note> ns=new NoteService().selectAllNote(n);
		
		for(Note nn:ns)
		{
			System.out.println("标题为:"+nn.getTitle());
			System.out.println("来自"+nn.getFromUser());
		}*/
		
//		System.out.println("数量为:"+new NoteService().selectCountAllNote(n));
		/*Project pro=new Project();
		pro.setKind(1);
		
		System.out.println("数量为"+new ProjectService().getProjectCountByDirection(pro, 1, 3));
		
		System.out.println(pro.getName());
		
		List<Project> p=new ProjectService().getSegregateProjectByDirection(pro, 1, 1, 50,3);
		for(Project ps:p)
		{
			System.out.println("名称为:"+ps.getName());
		}*/
		
		
		/*Integer a=null;
		
		String b=null;
		Integer.valueOf(b);
		
		System.out.println(a);*/
		
		/*Integer a=null;*/
		
		/*
		 * java中的反射机制
		 */
/*		  Teacher teacher=new Teacher();
		  String a=teacher.getClass().toString();
		  String b[]=a.split(" ");
		  Class cla=null;
		  try {
		   cla=Class.forName(b[1]);
		  } catch (ClassNotFoundException e) {
		   e.printStackTrace();
		  }
		  Field[] f=cla.getDeclaredFields();
		  //获取字段名
		  for(int i=0;i<f.length;i++){
		   System.out.println("属性名为:"+f[i].getName());
		  }*/
		
		
/*		Teacher t=new Teacher();
		t.setName("姚俊");
		
		System.out.println("类名为:"+ObjectToClass.getClass(t));
		
		Map names=ObjectToClass.getProperty(t);
		for(int i=0;i<names.size();i++)
		{
			System.out.println("属性名为:"+names.get(i).toString());
		}*/
/*		Teacher t=new Teacher();
		t.setName("姚俊");
		List lists=ObjectToClass.testGetOrSet(t);
		for(int i=0;i<lists.size();i++)
		{
			System.out.println(lists.get(i));
		}*/
		
/*		Teacher t=new Teacher();
		t.setTeaId(382);
		t.setPassword("1");
		Paper p=new Paper();
		p.setPapId(5728);
		p.setFauthor("姚俊");
		p.setDate(StringDate.StringToDate("2015-03-02"));*/
		
/*		Note n=new Note();
		n.setId(2);
		n.setTitle("姚俊");
		n.setContent("姚俊你好吗");
		Map<Integer,String> maps=new HashMap<Integer, String>();
		maps.put(0,"123");
		maps.put(1, "1");
		maps.put(2, "1");
		maps.put(3, "1");
		maps.put(4, "1");
		maps.put(5, "1");*/
		
/*		Teacher te=new Teacher();
		te.setName("姚俊");*/
		
//		new AwardService().updateBean(p);
		
/*		new InnovationService().deleteBean(n);*/
//		new CudBeanService().addBean(te);
/*		
		ObjectToClass.insertDataToBean(n);*/
	}
	
	
   

}
